package com.aiqinhai;

import java.util.Random;

public class helloworld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
        int[] age=new int[]{1,2,3,4,65};
        String[] name=new String[]{"zhangsan","lisi"};
        double[] height=new double[]{1.89,1.67};
        System.out.println(age[0]);
        for(int i=0;i<age.length;i++)
        {
            System.out.println(age[i]);
        }
        for(int i=0;i<name.length;i++)
        {
            System.out.println(name[i]);
        }
        for(int i=0;i<height.length;i++)
        {
            System.out.println(height[i]);
        }
        int[] arr=new int[]{11,22,33,44};
        int sum=0;
        for (int i = 0; i < arr.length; i++) {
            sum=sum+arr[i];
        }
        System.out.println(sum);
        int[] arr1=new int[]{1,2,3,4,5,6,7,8,9,10};
        int count=0;
        for(int i=0;i<arr1.length;i++)
        {
            if(arr1[i]%3==0)
            {
                count++;
            }
        }
        System.out.println(count);
        System.out.println("数组中能被3整除的有"+count+"个");
        int[] arr2={1,2,3,4,5,6,7,8,9,20};
        for(int i=0;i<arr2.length;i++)
        {
            if(arr2[i]%2==0)
            {
                arr2[i]/=2;
            }
            else {
                arr2[i]*=2;

            }

        }
        for(int i=0;i<arr2.length;i++)
        {
            System.out.println(arr2[i]);
        }
        int[] arr3=new int[5];
        arr3[0]=1;
        arr3[1]=214;
        arr3[2]=99;
        arr3[3]=2;
        arr3[4]=10;
        for (int i = 0; i < arr3.length; i++) {
            System.out.println(arr3[i]);
        }
        String[] name1=new String[2];
        name1[0]="chenyiyang";
        name1[1]="wanmeixue";
        for(int i=0;i<name1.length;i++)
        {
            System.out.println(name1[i]);
        }
        int[] arr4={33,44,55,66};
        int max=arr4[0];
        for(int i=0;i<arr4.length;i++)
        {

            if(max<arr4[i])
            {
                max=arr4[i];
            }
        }
        System.out.println(max);
        int[] arr5=new int[10];
        Random r=new Random();
        for(int i=0;i<arr5.length;i++)
        {
            int number=r.nextInt(100)+1;
            arr5[i]=number;

        }
        for(int i=0;i<arr5.length;i++)
        {
            System.out.println(arr5[i]);
        }
        int sum1=0;
        for(int i=0;i<arr5.length;i++)
        {
            sum1+=arr5[i];

        }
        System.out.println("数组中的和为"+sum1);
        int avg=0;

        avg=sum1/arr5.length;
        System.out.println("数组中平均值为"+avg);
        int[] arr6={2,3,4,5,9};
        int i=0;
        int j=arr6.length-1;
        while(i<=j)
        {
            int temp=arr6[i];
            arr6[i]=arr6[j];
            arr6[j]=temp;
            i++;
            j--;
        }
        for(int h=0;h<arr6.length;h++)
            {
                System.out.println(arr6[h]);
            }
        System.out.println("----------");
        int[] arr8=new int[]{1,2,3,4,5,6};
        Random randomindex=new Random();
        for (int k = 0; k < arr8.length; k++) {
            int m=randomindex.nextInt(arr8.length);
            int temp=arr8[k];
            arr8[k]=arr8[m];
            arr8[m]=temp;
        }
        for (int i1 = 0; i1 < arr8.length; i1++) {
            System.out.println(arr8[i1]);
        }




    }
}
